package forces;

import java.awt.Dimension;

import simulation.Mass;
import util.Location;
import util.Vector;

/**
 * defines a repulsion force from the top wall.
 * @author Schwartz & Roy
 *
 */
public class TopWallForce extends WallForce {

    /**
     * default constructor.
     */
    public TopWallForce() {
        super();
    }

    /**
     * constructor sets wallID to 1.
     * @param magnitude is the magnitude of the force
     * @param exponent is the exponent of the force
     */
    public TopWallForce(double magnitude, double exponent) {
        super(magnitude, exponent);
    }

    /**
     * @return the force vector from the bottom wall.
     */
    @Override
    public Vector getForceVector(Location massLocation, Dimension bounds) {
        if (isOn()) {
            return new Vector(Mass.DOWN_DIRECTION, getMagnitude() /
                    Math.pow(getSafeDistance(massLocation.getY()),
                            getExponent()));
        }
        return new Vector();
    }

}
